//
//  BaseTableViewController.swift
//  SinaWeiBo_18
//
//  Created by apple on 15/10/7.
//  Copyright © 2015年 apple. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController , VisitorLoginViewDelegate{

    var visitorLoginView: VisitorLoginView?
    
    //为手写代码准备  此方法一旦实现  所有xib／storyboard都会失效
    //试图控制器被初始化后  自动检测view是否为空  一旦为空  自动调用此方法
    override func loadView() {
        
        visitorLoginView = NSBundle.mainBundle().loadNibNamed("VisitorLoginView", owner: nil, options: nil).last as? VisitorLoginView

        visitorLoginView?.visitorDelegate = self
        
        view = visitorLoginView
        
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorWillRegister")
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorWillLogin")
  
        
    }
    
    func visitorWillRegister() {
        
        print(__FUNCTION__)
    }
    
    func visitorWillLogin() {
        
        print(__FUNCTION__)
    }
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
}
